﻿using project1113.Wrold;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static project1113.MainWindow;
using project1113;
using project1113.FSM;
using project1113.SpeechRecoginzer;

namespace project1113.states
{
    public class InteractionAstate: FsmState
    {
       public  InteractionAstate() : base("InteractionAstate") { }
        public override void Init()
        {
            //切换模式远程模式
            WorldModel.CurrentWorld.SpeechRecoginzer.Mode = SpeechRecognizeMode.mode_Remote;
        }
        public override void DoSomething()
        {
            WorldModel.CurrentWorld.SpeechRecoginzer.Mode = SpeechRecognizeMode.mode_Remote;
            DisplayHelper.LoadPage("ChatPage");
        }
        public override FsmState GetNextState()
        {
            if (WorldModel.CurrentWorld.Security.GetSafe())
            { 
                FsmState nextState;
                string intent = WorldModel.CurrentWorld.SpeechRecoginzer.GetIntent();
                
                if (intent == "hghjg" || intent == "P2p" || intent == "Handover" || intent == "LoseHand")//增加并且在忙判断
                {
                    nextState = new InteractionBState(intent);
                }
                else if(WorldModel.CurrentWorld.SpeechRecoginzer.Remote_IsOverChat())
                {
                    nextState = new WaitCallState("");
                }
                else
                {
                    nextState = this;
                }
                return nextState;

            }
            else
            {
                return new EmergenceState(this);
            }
               
        }
    }
}
